fix(examples): guard missing mount targets in remaining react examples#10305
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughThe PR updates 10 React example entry files to replace TypeScript non-null assertions on DOM root element lookups with explicit runtime null guards that throw a clear error message when the mount target is missing. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip You can disable sequence diagrams in the walkthrough.Disable the |
|
View your CI Pipeline Execution ↗ for commit 7f3b02d
☁️ Nx Cloud last updated this comment at |
🎯 Changes
Adds safety guards for mount targets in the remaining React examples that were not covered in #10226.
Why
Consistent with #10226, these examples used unsafe patterns such as:
document.getElementById('root') as HTMLElementrootElement!If the DOM element is missing or renamed, the example can crash at runtime with an unclear error. Adding explicit runtime guards improves reliability and developer experience.
Changes
#rootmount target is missingReactDOM.createRoot()Scope
Examples-only change. No package/runtime changes.
✅ Checklist
pnpm run test:pr.🚀 Release Impact
Summary by CodeRabbit
Release Notes